<?php
/**
 * This is areas/admin_dashboard template file. 
 *
 * @copyright     Copyright 2008-2010, LilCake.net
 * @link          http://lilcake.net LilCake.net
 * @package       lil
 * @subpackage    lil.views.areas
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
	$area_dashboard = array(
		'title_for_layout' => __d('lil', 'Welcome', true),
		'title' =>
			'<div class="head">' .
				'<h1>' . __d('lil', 'What would you like to do?', true) . '</h1>' .
			'</div>',
		'pre' => '<div class="lil_panel_full">',
		'post' => '</div>',
		'panels' => array(
			'welcome' => array(
				'pre' => '<div id="AdminDashboard"><ul class="actions">',
				'post' => '</ul></div>',
				'lines' => array(
					'area' => array(
						'parameters' => '',
						'caption'    => $this->Html->link(
							__d('lil', 'Change admin area', true),
							array(
								'plugin'     => 'lil',
								'controller' => 'areas',
								'action'     => 'list',
								'admin'      => true
							)
						),
					),
					0 => array(
						'parameters' => '',
						'caption'    => '<hr />'
					),
					'preferences' => array(
						'parameters' => '',
						'caption'    => $this->Html->link(
							__d('lil', 'Edit user profile and password', true),
							array(
								'plugin'     => 'lil',
								'controller' => 'users',
								'action'     => 'properties',
								'admin'      => true
							),
							array(
								'class' => 'small'
							)
						),
					),
					'logout' => array(
						'parameters' => '',
						'caption'    => $this->Html->link(
							__d('lil', 'Logout', true),
							array(
								'plugin'     => 'lil',
								'controller' => 'users',
								'action'     => 'logout',
								'admin'      => false
							),
							array(
								'class' => 'small'
							)
						),
					),
				)
			),
		),
	);
	
	///////////////////////////////////////////////////////////////////////////////////////////////
	// call plugin handlers
	$area_dashboard = $this->callPluginHandlers('admin_dashboard', $area_dashboard);
	
	$this->set('title_for_layout', $area_dashboard['title_for_layout']);
	
	echo $area_dashboard['title'] . PHP_EOL;
	
	echo $area_dashboard['pre'];
	
	foreach ($area_dashboard['panels'] as $panel) {
		echo $panel['pre'];
		if (!empty($panel['lines'])) {
			foreach ($panel['lines'] as $name => $line) {
				if (is_array($line)) {
					$parameters = array();
					if (!empty($line['parameters'])) {
						$parameters = (array)$line['parameters'];
					}
					echo '<li' . implode(' ', $parameters) . '>' . $line['caption'] . '</li>';
				} else {
					echo '<li>' . $line . '</li>';
				}
			}
		} else if (!empty($panel['html'])) {
			echo $panel['html'];
		}
		echo $panel['post'] . PHP_EOL;
	}
	
	echo $area_dashboard['post'];
?>